#include "show_bytes.h"

typedef unsigned packed_t;

int xbyte(packed_t word, int bytenum){

    int result = (word >> (bytenum << 3)) & 0xff;

    if(((word) >> ((bytenum << 3) - 1)) & 1){
        int mask = -1;
        mask <<= 8;
        result |= mask;
    }

    return result;
}
